package com.SmartCare.service.impl.health;

import com.SmartCare.mapper.health.HealthCheckMapper;
import com.SmartCare.pojo.health.HealthCheck;
import com.SmartCare.service.health.HealthCheckService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 健康检测表 服务实现类
 */
@Service
public class HealthCheckServiceImpl extends ServiceImpl<HealthCheckMapper, HealthCheck> implements HealthCheckService {
/*
    //查询今日健康数据
    @Override
    public Result getHealthTodayData(Long userId) {
        LambdaQueryWrapper<HealthCheck> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(HealthCheck::getElderlyId,userId);
        queryWrapper.like(HealthCheck::getCreatedTime, DateTimeUtils.getCurrentDateTime());
        List<HealthCheck> list = list(queryWrapper);
        return Result.success(list);
    }
 */


/*
    @Override
    public Result getHealthWeekData(Long userId) {
        LambdaQueryWrapper<HealthCheck> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(HealthCheck::getElderlyId,userId);

        LocalDate currentDate= DateTimeUtils.getCurrentDateTime();
        // 计算六天前的日期
        LocalDate sixDaysAgo = currentDate.minus(6, ChronoUnit.DAYS);

        LocalDateTime startTime = LocalDateTime.of(sixDaysAgo, LocalTime.MIN);
        LocalDateTime endTime = LocalDateTime.of(currentDate, LocalTime.MAX);
        queryWrapper.between(HealthCheck::getCreatedTime,startTime,endTime);
        List<HealthCheck> list = list(queryWrapper);
        return Result.success(list);
    }
*/
}
